import request from './axiosConfig'

// 获取所有订单
export const getAllOrders = () => {
  return request({
    url: '/orders',
    method: 'get'
  })
}

// 获取订单详情
export const getOrderById = (id: number) => {
  return request({
    url: `/orders/${id}`,
    method: 'get'
  })
}

// 获取用户所有订单
export const getUserOrders = (userId: number) => {
  return request({
    url: `/orders/user/${userId}`,
    method: 'get'
  })
}

// 创建订单
export const createOrder = (data: {
  userId: number
  roomID: number
  checkInDate: string
  checkOutDate: string
}) => {
  return request({
    url: '/orders',
    method: 'post',
    data
  })
}

// 更新订单
export const updateOrder = (id: number, data: any) => {
  return request({
    url: `/orders/${id}`,
    method: 'put',
    data
  })
}

// 取消订单
export const cancelOrder = (id: number) => {
  return request({
    url: `/orders/${id}`,
    method: 'delete'
  })
} 